package Day06.src;

/*
 * @Description: 
 * @Author: Aroma
 * @Date: 2024-09-02 17:23:26
 * @LastEditors: Aroma
 * @LastEditTime: 2024-09-02 18:50:08
 * @别瞎看: 你个无脑牛马
 */
//键盘录入一个整数，求从1到这个数的整数之和

import java.util.Scanner;

public class Test04{
    public static void main(String[] args) {
        System.out.println("输入一个整数：");
        Scanner scanner=new Scanner(System.in);
        int num=scanner.nextInt();
        int sum=0;
        for(;num>0;num--){
            sum+=num;   
        }
        System.out.println("1到这个整数" + num + "的和为"+sum);
    }
    
}